-
-
Notifications
You must be signed in to change notification settings - Fork 394
[Ruby 3.4] Add spec for Tempfile.create and its new anonymous: argument #1295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Ruby 3.4] Add spec for Tempfile.create and its new anonymous: argument #1295
Conversation
| @tempfile = Tempfile.create(anonymous: true) | ||
| @tempfile.should_not.closed? | ||
| @tempfile.path.should == "#{Dir.tmpdir}/" | ||
| File.file?(@tempfile.path).should be_false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: If you are agree to use File.exist? then there are still File.file? calls left in the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those left over are intentional, as @tempfile.path may refer to Dir.tmpdir, which exists but not a file, and in the first test checks that it's not a FIFO or something. Though I'm now not sure that using exist? is even better, because it may cause more questions.
|
Could you please squash code review changes (I suppose they are mostly related to the first commit)? |
|
I'm not sure exactly how to better squash this? Two total commits (general spec and 3.4 spec)? One commit? |
3be91cf to
3523409
Compare
|
@andrykonchin I've squashed changes into two commits. Please tell me if that's what you meant. And thank you very much for the thorough reviews! |
|
Thank you! It's exactly what I meant. |
From #1265: new
anonymous:argument toTempfile.create.Turns out that there was no spec for the method at all! But there was an empty spec for
Tempfile.callback, which doesn't exist.Also, there is a spec for
Tempfile#_close, which is a protected method and seems like an implementation detail. I think that that spec should be deleted.